package com.example.netty.tcp.message;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.List;

public class AlarmReport extends BaseMessage {
    public AlarmReport() {
        setMsgType(410);
    }

    @JsonProperty("alarmList")
    private List<Alarm> alarmList = new ArrayList<>();

//    public void addAlarm(String id, String alarmLevel, String alarmDesc) {
//        alarmList.add(new Alarm(alarmCode, alarmLevel, alarmDesc));
//    }

    public List<Alarm> getAlarmList() {
        return alarmList;
    }

    public void setAlarmList(List<Alarm> alarmList) {
        this.alarmList = alarmList;
    }

    public static class Alarm {
        private String id;
        private long alarmTime;
        //private String alarmLevel; // 1:紧急, 2:重要, 3:一般, 4:提示
        private String alarmDesc;
        private int alarmFlag; // 新增字段，对应文档中的alarmFlag（1=开始，0=结束）
        private String batteryCell; // 新增字段：电池电芯编号（如"01"表示第1节电芯）


        public Alarm() {}

        public Alarm(String id,  String alarmDesc,int alarmFlag,String batteryCell) {
            this.id = id;
//            this.alarmLevel = alarmLevel;
            this.alarmDesc = alarmDesc;
            this.alarmTime = System.currentTimeMillis();
            this.alarmFlag = alarmFlag;
            this.batteryCell = batteryCell;
        }

        public String getBatteryCell() {
            return batteryCell;
        }

        public void setBatteryCell(String batteryCell) {
            this.batteryCell = batteryCell;
        }

        public int getAlarmFlag() {
            return alarmFlag;
        }

        public void setAlarmFlag(int alarmFlag) {
            this.alarmFlag = alarmFlag;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }



        public String getAlarmDesc() {
            return alarmDesc;
        }

        public void setAlarmDesc(String alarmDesc) {
            this.alarmDesc = alarmDesc;
        }

        public long getAlarmTime() {
            return alarmTime;
        }

        public void setAlarmTime(long alarmTime) {
            this.alarmTime = alarmTime;
        }
    }
}
